<?php


namespace app\common\enum;

use app\common\service\Redis;

class MainEnum
{
    public const GROUP_ADMIN                  = 1;
    public const GROUP_USER                   = 2;
    public const MEDIA_TYPE_VIDEO             = 'VIDEO';
    public const MEDIA_TYPE_IMAGE             = 'IMAGE';
    public const MEDIA_STORAGE_LOCATION_LOCAL = 'LOCAL';
    public const MEDIA_STORAGE_LOCATION_QINIU = 'QINIU';
    /**
     * APP_TOKEN
     */
    public const APP_TOKEN_EXPIRE_TIMESTAMP = 3600 * 24 * 7;
    /**
     * map
     */
    public const MAP_TYPE_PROVINCE = 'province';
    public const MAP_TYPE_CITY     = 'city';
    public const MAP_TYPE_AREA     = 'area';
    /**
     * -1 正常错误
     * -10 令牌错误
     * -11 令牌过期
     * -50 微信小程序需要登录
     */
    public const ERROR_TOKEN_ERROR  = -10;
    public const ERROR_TOKEN_EXPIRE = -11;
    public const ERROR_TOKEN_NEED   = -12;
    /**
     * 优惠券
     */
    public const COUPON_ISSUE_STATUS  = [
        '未开启' => 0,
        '已开启' => 1,
    ];
    public const COUPON_TYPE          = [
        '满减'    => 1,
        '折扣'    => 2,
        '随机减金额' => 3,
    ];
    public const COUPON_USER_STATUS   = [
        '待使用' => 0,
        '已使用' => 1,
        '已过期' => 2,
        '已取消' => 3,
    ];
    public const COUPON_USER_GET_TYPE = [
        '新用户首次领取' => 1,
        '管理员赠送'   => 2,
        '购买商品赠送'  => 3,
        '签到赠送'    => 4,
        '积分兑换'    => 5,
    ];
    /**
     * 订单
     */
    public const ORDER_STATUS_WAIT_PAY               = 1;     #待付款
    public const ORDER_STATUS_WAIT_SHIPMENT          = 2;     #待发货
    public const ORDER_STATUS_WAIT_SIGN_FOR          = 3;     #待签收
    public const ORDER_STATUS_SIGN_FOR_ED            = 4;     #已签收
    public const ORDER_STATUS_DONE_BUT_WAIT_APPRAISE = 100;   #已完成(未评价)
    public const ORDER_STATUS_DONE_AND_APPRAISE      = 101;   #已评价
    public const ORDER_STATUS_CANCEL                 = 110;   #已取消
    public const ORDER_STATUS_REFUND                 = 120;   #已退款
    public const ORDER_CANCEL_TYPE                   = [
        '用户主动' => 1,
        '超时自动' => 2,
        '店长主动' => 3,
    ];
    /**
     * 订单退款
     */
    public const ORDER_LIST_REFUND_WAIT       = 0;     #未申请退款
    public const ORDER_LIST_REFUND_ING        = 1;     #申请退款中
    public const ORDER_LIST_REFUND_DAILURU    = 10;    #商家同意退货退款，待录入快递单号
    public const ORDER_LIST_REFUND_DAISHOUHUO = 11;    #买家已发货，待商家收货
    public const ORDER_LIST_REFUND_DAIYANHUO  = 12;    #商家同意退货退款，用户已录入快递单号，待商家验货
    public const ORDER_LIST_REFUND_WAIT_PAY   = 99;    #店家同意退款，系统退款中
    public const ORDER_LIST_REFUND_DONE       = 100;   #同意退款
    public const ORDER_LIST_REFUND_REFUSE     = -100;  #拒绝退款
    /**
     * 订单优惠券状态
     */
    public const ORDER_COUPON_STATUS = [
        '已使用' => 1,
        '未使用' => 0,
        '已退还' => -1,
    ];
    /**
     * 佣金STATUS
     */
    public const USER_ORDER_BROKERAGE_STATUS = [
        '已退款'   => -2,
        '冻结中'   => -1,
        '订单未完成' => 0,
        '可提现'   => 1,
        '已提现'   => 2,
    ];
    /**
     * 佣金申请表STATUS
     */
    public const USER_ORDER_BROKERAGE_APPLY_STATUS = [
        '已拒绝'    => -1,
        '已申请待审核' => 0,
        '已通过'    => 1,
    ];
    /**
     * 签收状态
     */
    public const QS_STATUS = [
        '未收到货' => 0,
        '已收到货' => 1,
    ];
    /**
     * 退款类型
     */
    public const QK_TYPE = [
        '退款'   => 1,
        '退货退款' => 2,
    ];
    /**
     * 商品状态
     */
    public const PRODUCT_STATUS = [
        '已上架' => 1,
        '已下架' => 0,
    ];
    public const RabbitMQ       = [

        //        'order'       => [
        //            'direct' => 'order.orderCreated',
        //            'exchangeType' => 'order.orderCreated',
        //            'routingKey' => 'order.orderCreated',
        //        ],
        //        'direct_order_delay' => [
        //            'order_delay.unPay',
        //        ],
        //        'exchange'           => [
        //            '消息'  => 'message',
        //            '订单'  => 'order',
        //            '优惠券' => 'coupon',
        //        ],
        'routingKey' => [
            '消息|用户注册成功' => 'message&registerDone',
            '订单|付款超时'   => 'order&paymentTimedOut',
            '优惠券|过期'    => 'coupon&expired',
        ],
        'queue'      => [
            '消息|用户注册成功' => 'message&registerDone',
            '订单|付款超时'   => 'order&paymentTimedOut',
            '优惠券|过期'    => 'coupon&expired',
        ],
    ];
}